package com.hotel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hotel.entity.SysRole;
import com.hotel.mapper.SysRoleMapper;
import com.hotel.service.SysRoleService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * 系统角色服务实现类
 * 
 * @author Hotel Management Team
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {

    //@Override
    //public boolean checkRoleCodeUnique(Long id, String roleCode) {
    //    QueryWrapper<SysRole> queryWrapper = new QueryWrapper<>();
    //    queryWrapper.eq("role_code", roleCode);
    //    if (id != null) {
    //        queryWrapper.ne("id", id);
    //    }
    //    return count(queryWrapper) == 0;
    //}
    //
    //@Override
    //public boolean isRoleAssignedToUser(Long roleId) {
    //    // This method would typically query a user-role mapping table.
    //    // For now, as per the controller's comment, we'll assume it's not assigned.
    //    // Replace with actual logic when user-role mapping is implemented.
    //    // Example: return sysUserRoleMapper.selectCount(new QueryWrapper<SysUserRole>().eq("role_id", roleId)) > 0;
    //    return false;
    //}
    //
    //@Override
    //public void enableRole(Long roleId) {
    //    SysRole role = getById(roleId);
    //    if (role != null) {
    //        role.setStatus("active");
    //        updateById(role);
    //    }
    //}
    //
    //@Override
    //public void disableRole(Long roleId) {
    //    SysRole role = getById(roleId);
    //    if (role != null) {
    //        role.setStatus("disabled");
    //        updateById(role);
    //    }
    //}
    //
    //// Other methods from IService are inherited and can be used directly by the controller.
    //// Specific business logic required by SysRoleController that is not a simple CRUD
    //// or already covered by IService can be added here.
}